<div id="default_header_section">
<h3><?=$this->translate ( 'Ads list' ).'  -  '.$this->escape( $this->user[username] );?></h3>
</div>

<div id="main">
<div class="span-18">

<ul id="tabnav">
        <?=$this->editprofile ?>
	<li ><a   id="<?=(preg_match("/profile/", $_SERVER['REQUEST_URI']))?"tab_active":"lala"?>" href="/<?=$this->lang ?>/profile/<?=$this->user[username] ?>"><?=$this->translate('profile');?></a></li>
	<li ><a  id="<?=(preg_match("/listuser/", $_SERVER['REQUEST_URI']))?"tab_active":"lala"?>" href="/<?=$this->lang ?>/ad/listuser/id/<?=$this->user[id] ?>"><?=$this->translate('ads');?></a></li>
</ul>

<?php if ($this->ad != null):?>

       <?php foreach ($this->paginator as $key => $val): ?>
        <div class="ad_excerpt">
           <h4><a href="/<?=$this->lang ?>/ad/show/id/<?=$this->escape($val['ad_id']).'/'.$this->escape($val['title']) ?>">
           <?=$this->escape($val['title']) ?></a></h4>

             <?php
// if you are the ad owner or admin, then show edit link
$auth = Zend_Auth::getInstance ();
if ($val['user_owner'] == $auth->getIdentity()->id): ?>
 <div>
<a href="/<?=$this->lang ?>/ad/edit/id/<?=$val['ad_id'] ?>">
            <img alt="<?=$this->translate('Edit this ad') ?>" src="/images/edit_ad.png"/>&nbsp;<?=$this->translate('Edit this ad') ?></a>
 </div><br />
<?php endif;?>

            <?
           if ($val['type'] == 1){
               $val['type_name'] = 'give';
           }
           if ($val['type'] == 2){
               $val['type_name'] = 'want';
           }
           ?>

             <h6><a href="/<?=$this->lang.'/woeid/'.$val['woeid_code'].'/'.$val['type_name'] ?>">
             <?=$this->woeidName($val['woeid_code'], $this->lang).' > '. $this->translate((string)$val[type_name]) ?> </a></h6>


            <?php
            if ($val['type'] == 1): ?>
            <span class="ad_status <?=$val['status'] ?>"><?=$this->translate($val['status']) ?></span>
            <?php endif;?>
            <span class="ad_date"><?=$this->translate('Posted on '). $this->escape(date( $this->translate('l dS \o\f F Y H:i:s'), strtotime($val['date_created']))) ?>
            </span>
	   <div><?php echo $this->escapeEmail( $this->escape($val['body']) ) ?></div>
            <div class="ad_meta_info">
               <?php if ($val['readings_count']): ?>
                    <?=$val['readings_count'] . ' ' .$this->translate('readings') ?>
                <?php endif;?>
                <?php if ($val['comments_count']): ?>
                 <?=', '.$this->escape( $val['comments_count'] == null  ? 0 : $val['comments_count'] ).' '.$this->translate('comments') ?>
                 <?php endif;?>
           </div>

        </div>
        <?php endforeach; ?>


<?php else: ?>
    <h4><?=$this->translate ( 'This user does not have ads yet');?></h4>
<?php endif;?>

<?php echo $this->paginationControl($this->paginator, 'Sliding', 'partials/paginator_ads.phtml'); ?>

</div> <!-- /div ads -->

</div> <!-- /main -->


<div class="google_ads">
<!-- google adsense block -->
<script type="text/javascript"><!--
google_ad_client = "pub-7190437604389924";
/* 160x600, creado 9/01/10 */
google_ad_slot = "9535564204";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- end  of google adsense block -->
</div>